{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $op == 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('footer', array('op' => 'post'))}">添加菜单</a></li>
	<li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('footer', array('op' => 'display'))}">菜单列表</a></li>
</ul>
<style>
.table td span{display:inline-block;margin-top:4px;}
.table td input{margin-bottom:0;}
th{
	text-align: center !important;
}
td{
	text-align: center !important;
}
.red{color:red;font-weight:bold}
</style>
{if $op == 'display'}
<div class="main">
	<div style="padding:15px;background: white;">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th>序号</th>
					<th>菜单名</th>
					<th>默认图标</th>
					<th>链接</th>
					<th>修改/删除</th>
				</tr>
			</thead>
			<tbody>
					{loop $list $item}
				<tr>
					<td>{$item['displayorder']}</td>
					<td>{$item['title']}</td>
					<td><img src="{php echo toimage($item['thumb'])}" style="width: 60px;height: 60px"></td>
					<td>{$item['url']}</td>
					<td>
						<a href="{php echo $this->createWebUrl('footer', array('op' => 'post', 'id' => $item['id']))}" title="编辑" class="btn btn-sm btn-default"><i class="fa fa-edit"></i></a>
						<a onclick="return confirm('确认删除吗？'); " href="{php echo $this->createWebUrl('footer', array('op' => 'del','id' => $item['id']))}" title="删除" class="btn btn-sm btn-danger"><i class="fa fa-remove"></i></a>
					</td>
				</tr>
				
				{/loop}
			</tbody>
		</table>
		{$pager}
	</div>
</div>
{elseif $op == 'post'}
{php load()->func('tpl')}
<div class="panel panel-info">
		<div class="panel-body">
			<form action="" method="post" class="form-horizontal" role="form">
			<input type="hidden" name="id" value="{$item[id]}">
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">菜单名称</label>
				<div class="col-sm-4">
					<input class="form-control" required="required" name="title" type="text" value="{$item['title']}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">默认图标</label>
				<div class="col-sm-4">
					{php echo tpl_form_field_image('thumb',$item['thumb'])}
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">默认颜色</label>
				<div class="col-sm-4">
					{php echo tpl_form_field_color('color',$item['color']?$item['color']:'#000000')}
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">链接</label>
				<div class="col-sm-4">
					<input class="form-control" name="url" type="text" value="{$item['url']}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">排序</label>
				<div class="col-sm-4">
					<input type="number" name="displayorder"  class="form-control" value="{$item['displayorder']}">
				</div>
			</div>
			<button type="submit" class="btn btn-primary" name="submit" value="提交">保存</button>
			<input type="hidden" name="token" value="{$_W['token']}" />
			</form>
	</div>
</div>
{/if}
{template 'common/footer'}
